package com.visionblue.business.ship.page.orders

import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.visionblue.business.ship.R
import com.visionblue.business.ship.base.BaseActivity
import com.visionblue.business.ship.page.collection.CollectionActivity
import com.visionblue.business.ship.page.collection.panel.PanelFragment
import com.visionblue.business.ship.util.ActivityUtils
import kotlinx.android.synthetic.main.activity_pdf_view.*

/**
 * des:
 * author: tekabo
 * date: 2021/4/1
 */
class PdfActivity : BaseActivity(){

    override val layoutId: Int
        get() = R.layout.activity_pdf_view


    override fun initView(savedInstanceState: Bundle?) {
        super.initView(savedInstanceState)

        iv_pdf_Back.setOnClickListener {
            finish()
        }

        ActivityUtils.addFragmentToActivity(
                supportFragmentManager,
                PdfViewFragment.newInstance(intent.getStringExtra("pdfUrl")),
                R.id.flPdf, PDF_TAG
        )
    }

    companion object {

        private const val PDF_TAG = "pdfTag"
        fun start(context: Context, pdfUrl: String) {
            Intent(context, PdfActivity::class.java)
                    .putExtra("pdfUrl", pdfUrl)
                    .run {
                        context.startActivity(this)
                    }
        }
    }
}